package se.mbaeumer.fxtodo.gui;

import se.mbaeumer.fxtodo.core.model.ICSInfo;
import javafx.geometry.Orientation;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.FlowPane;
import javafx.scene.paint.Color;
import javafx.stage.Modality;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class ICSInfoStage extends Stage {

	private Group root = new Group();
	private Scene scene;
	private FlowPane flowGeneral;
	// task.title / summary
	// description
	// start time
	// end time
	// priority
	// status
	private Label lblSummary = new Label("Summary: ");
	private Label lblDescription = new Label("Description: ");
	private Label lblStartTime = new Label("Start time: ");
	private Label lblEndTime = new Label("End time: ");
	private Label lblStatus = new Label("Status: ");
	private Label lblPriority = new Label("Priority: ");
	
	private ICSInfo icsInfo;
	public ICSInfoStage(ICSInfo icsInfo){
		this.icsInfo = icsInfo;
		
		this.scene = new Scene(this.root, 200, 200, Color.LIGHTGRAY);
		this.setScene(this.scene);
		
		this.setTitle("ICS Info");
		
		this.initModality(Modality.APPLICATION_MODAL);
		this.initStyle(StageStyle.UTILITY);
		
		this.initLayout();
	}
	
	private void initLayout(){
		this.flowGeneral = new FlowPane(Orientation.VERTICAL);
		this.flowGeneral.setVgap(10);
		this.root.getChildren().add(this.flowGeneral);

		this.lblSummary.setText(this.lblSummary.getText() + this.icsInfo.getsummary());
		this.lblDescription.setText(this.lblDescription.getText() + this.icsInfo.getDescription());
		this.lblStartTime.setText(this.lblStartTime.getText() + this.icsInfo.getStartTimeString());
		this.lblEndTime.setText(this.lblEndTime.getText() + this.icsInfo.getEndTimeString());
		this.lblStatus.setText(this.lblStatus.getText() + this.icsInfo.getStatus().toString());
		this.lblPriority.setText(this.lblPriority.getText() + this.icsInfo.getPriority().toString());
		this.flowGeneral.getChildren().addAll(this.lblSummary, this.lblDescription, 
				this.lblStartTime, this.lblEndTime, this.lblStatus, this.lblPriority);
	}
}
